// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace SnapObjects.Data
{
    public class ColumnAttributeInfo : IColumn
    {
        private readonly ColumnAttribute _columnAttribute;

        public ColumnAttributeInfo(ColumnAttribute columnAttribute)
        {
            _columnAttribute = columnAttribute;
            this.Name = _columnAttribute.Name;
        }

        public string Name { get; internal set; }

        public int Order => _columnAttribute.Order;

        public string TypeName => _columnAttribute.TypeName;

        public bool NameDefined => !String.IsNullOrWhiteSpace(_columnAttribute.Name);
    }
}
